#include <iostream>
#include <string>

using namespace std;

int main()
{
    string s;
    cout<<"Vvedite posledovatelnost"<<endl;
    cin>>s;
    string si;
    char a;
    for (int i = 0;i<s.length();i++)
    {
        a=s[i];
        if ((a == '(') || (a == '{') || (a == '[') || (a == '<') || si=="")
                si+=a;
        else
        {
            if (si!="")
        {
            if (((a==')')&&(si[si.length()-1]=='(')) || ((a=='}')&&(si[si.length()-1]=='{')) || ((a==']')&&(si[si.length()-1]=='[')) || ((a=='>')&&(si[si.length()-1]=='<')))
                si.pop_back();
        }
       }
       }
    if (si=="")
        cout<<"Yes";
    else cout<<"No";
return 0;}
